<?php
/**
 * Created by swagger_zxd.
 * User: zxd
 * Date: 2018/2/23
 * Time: 11:35
 */

namespace app\common\controller;


use app\admin\model\roomSet;
use think\Controller;

class Tool extends Controller{

    //加载游戏名
    public function loadGames(){
        $game=new roomSet();
        return $game->loadGames();
    }


    //加载房间名
    public function loadRooms(){
        $data=$this->request->param();
        $kindName=$data['game'];
        $game=new roomSet();
        return $game->loadRooms($kindName);
    }

    public function loadGamePlatform(){
        $records="";
        try{
            $pdo=odbcLink();
            $sqlstr="exec JJ_Get_AccountsInfo_PackType";
            $sth=$pdo->query($sqlstr);
            $i=1;
            do{
               $rowset=$sth->fetchAll(\PDO::FETCH_ASSOC);
               switch($i){
                   case 1:
                       if(!empty($rowset)){
                           foreach($rowset as $k=>$value){
                               $records[$k]['packId']=$rowset[$k]['Pack_Id'];
                               $records[$k]['packName']=iconv("gbk","utf-8",$rowset[$k]['PackName']);
                           }

                       }else{
                           $records="error!";
                       }
                       break;
               }
            }while($sth->nextRowset());
        }catch(\Exception $e){
            echo $e->getMessage();
        }
        $out=['records'=>$records];
        return json($out);

    }

}